#version 120

uniform float scale = 1.;
uniform float angle = 0.;
uniform vec3 displacement = vec3(0.0, 0.0, 0.0);

void main() {
	gl_TexCoord[0] = gl_MultiTexCoord0;
	
	//scaling
	vec4 position = vec4(gl_Vertex.xy*scale, gl_Vertex.zw);
	
	//rotation
	position.xy = vec2(cos(angle)*position.x + sin(angle)*position.y, cos(angle)*position.y + sin(-angle)*position.x);
	
	//transformation
	position = vec4(position.xyz+displacement, position.w);
	
	vec4 vertex = gl_ModelViewProjectionMatrix*position;
	
	gl_Position = vertex;
}